cmake_minimum_required(VERSION 3.0.0)
project(curlp_build VERSION 0.1.0)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

# Add the source in project root directory
aux_source_directory(. DIRSRCS)
# Add header file include directories
if(MSVC)
  include_directories(
    "D:/UserDev/Qt Widget/curl-7.61.1/builds/libcurl-vc15-x64-release-dll-zlib-dll-ipv6-sspi-winssl/include"
    )
  link_directories(
    "D:/UserDev/Qt Widget/curl-7.61.1/builds/libcurl-vc15-x64-release-dll-zlib-dll-ipv6-sspi-winssl/lib"
    )
endif()

if(MSYS OR MINGW)
  include_directories("C:/Program Files (x86)/CURL/include")
  link_directories("C:/Program Files (x86)/CURL/lib")
endif()

if(LINUX)
  include_directories(/usr/include/x86_64-linux-gnu)
  message("this is linux env")
endif(LINUX)

if(UNIX)
  include_directories(/usr/include/x86_64-linux-gnu)
  message("this is unix env")
endif(UNIX)

include_directories(src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

get_property(dirs DIRECTORY ${INCLUDE_DIRECTORIES} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
  message(STATUS "dir='${dir}'")
endforeach()

foreach(path ${CMAKE_PREFIX_PATH})
  message("prefix Path: " ${path})
endforeach(path)

message("CMAKE_CURRENT_SOURCE_DIR is " ${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_CXX_FLAGS
    "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -fno-rtti -fno-exceptions")
message("CMAKE_CXX_FLAGS IS " ${CMAKE_CXX_FLAGS})

include(CTest)
enable_testing()

add_subdirectory(tool)

find_package(Qt5Core)

add_executable(curlp_build src/main.cpp)

target_link_libraries(curlp_build tool_request)
target_link_libraries(curlp_build Qt5::Core)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
